<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style type="text/css">
        .button {
            width: 100px;
            height: 29px;
            font-size: 16px;
            color: white;
            background-color: black;
            padding: 0;
            vertical-align: top;
            border: 0;
        }

        .textbox {
            height: 25px;
            padding: 0;
            vertical-align: top;
        }

        span {
            font-size: 16px;
            height: 29px;
            line-height: 29px;
        }
    </style>

</head>

<body>
    <div>
        <input class="button" type="button" value="使用ajax" onclick="ajax()" />
    </div>
    <div>
        <input class="button" type="button" value="使用axios" onclick="axdata()" />
    </div>
    <div>
        <input class="button" type="button" value="使用HTTP请求" onclick="htdata()" />
    </div>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/qs/6.7.0/qs.min.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
    <script type="text/javascript">
        function ajax() {
            $.ajax
                ({
                    url: "http://127.0.0.1:8000/",
                    dataType: "text",
                    type: "get",
                    success: function (res) {
                        console.log(res)
                    },
                    error: function () {
                        alert('failed!');
                    },
                });
        }
        function axdata() {
            axios({
                url: 'http://127.0.0.1:8000/',
                method: 'GET',
            }).then(function (res) {
                console.log(res);
            });
        }
        function htdata() {
            var Http = new XMLHttpRequest();
            Http.open("GET", "http://127.0.0.1:8000/")
            Http.send();
            Http.onreadystatechange = (e) => {
                console.log(Http.responseText)
            }
        }
    </script>

</body>

</html>